#include "log.h"

Logger Log::_logger = Logger::getInstance(LOG4CPLUS_TEXT("main_log"));

Log::Log() {
}

Log::~Log() {
}

Log& Log::instance() {
	static Log log;
	return log;
}

bool Log::open_log() {
	SharedFileAppenderPtr _append(new RollingFileAppender(LOG4CPLUS_TEXT("./logs/SSMSFileAssistant.log"), 5 * 1024 * 1024, 3, true, true));
	_append->setName(LOG4CPLUS_TEXT("log"));
	_append->setLayout(std::unique_ptr<Layout>(new PatternLayout(LOG4CPLUS_TEXT("%D{%Y/%m/%d %H:%M:%S,%Q}[%l][%p]:%m%n"))));
	Log::_logger.addAppender(SharedAppenderPtr(_append.get()));
	Log::_logger.setLogLevel(NOT_SET_LOG_LEVEL);

	return true;
}
